package org.sword.wechat4j.api.material;

import com.alibaba.fastjson.JSON;
import org.junit.Test;
import org.sword.wechat4j.api.WechatClient;
import org.sword.wechat4j.api.request.material.Cgi_binMaterialBatchget_materialPost;
import org.sword.wechat4j.api.response.material.MaterialList;
import org.sword.wechat4j.type.ErrorCode;

import java.io.IOException;

/**
 * Created by wxc on 2016/8/22.
 */
public class MaterialGetTrst {

    private static final String token = "sYwdg5dG86qt7BEHYoWG2OZpwD0UohHL5aPzkMR127bX2zaVx70bc6ntmhvJl0KCvfw4OqwglTEQdJ-a_3eDt7P99paYvdAok6H6pP-lxfNUZoxOMfXr4wTEzfOlMHrcOOIgAHAHHB";


    @Test
    public void testGet() throws IOException {
        Cgi_binMaterialBatchget_materialPost req = new Cgi_binMaterialBatchget_materialPost();
        req.setCount(2);
        req.setOffset(0);
        req.setType("news");
        MaterialList execute = new WechatClient().execute(req,token);
        System.out.println(JSON.toJSONString(execute));
    }

    @Test
    public void getErrocode() {
        System.out.println(ErrorCode.mean(40004L));
    }
}
